﻿
using System;
using Patterns4Net.Attributes.DesignPatterns;

namespace EnforcerExample.GUI
{
	[Immutable]
    public class Label : IWidget
    {
        public Label(int width, int height, string text)
        {
            this.Width = width;
            this.Height = height;
            this.Text = text;
        }

        public int Width { get; private set; }

        public int Height { get; private set; }

        public string Text { get; private set; }

        public virtual void RenderText()
        {
            Console.WriteLine(this.Text);
        }

        //// To make the implementation valid, comment out this method
        public static void SetText(Label label, string text)
        {
            label.SetText(text);
        }

        private void SetText(string text)
        {
            // this is the change of an internal state that can be invoked from outside.
            this.Text = text;   
        }
    }
}
